package com.wanxi.app.controller.coupon;

import com.wanxi.app.service.coupon.CouponAppService;
import com.wanxi.coupon.api.query.CouponUserQuery;
import com.wanxi.coupon.api.result.CommonResult;
import com.wanxi.coupon.api.vo.CouponUserTDO;
import com.wanxi.coupon.api.vo.CouponUserVo;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: CouponAppController
 * Description:
 * date: 2022/1/17 10:10
 *
 * @author lxl
 * @version 1.0
 * @since JDK 1.8
 */
@Api(tags = "用户优惠券")
@RestController
@RequestMapping("app/coupon")
public class CouponAppController {

        @Resource
        private CouponAppService service;

    /**
     * @Author lxl
     * @Description  用户按条件查询优惠券信息接口
     **/
    @GetMapping("user/findAll")
   public CommonResult<List<CouponUserVo>> userFindAll( CouponUserQuery coupon ){
        return service.userFindAll(coupon);
    }

    /**
     * @Author lxl
     * @Description  用户领取优惠券信息接口
     **/
    @PostMapping("user/add")
    public CommonResult userAdd( CouponUserTDO coupon){
        return service.userAdd(coupon);
    }

    /**
     * @Author lxl
     * @Description  用户使用
     **/
    @PostMapping("user/useCoupon")
    public CommonResult useCoupon( CouponUserTDO couponUserTDO){
        return service.useCoupon(couponUserTDO);
    }
}
